package km.TestAnimationGif;

import android.content.*;
import android.util.*;
import android.view.*;
import android.view.animation.*;
import android.widget.*;

public class AniView extends ImageView{
	Animation refreshani = null;    
	public AniView(Context context){
		super(context);
		setBtnAni();
	}

	 public AniView(Context context, AttributeSet attrs) {
		super(context, attrs);
			setBtnAni();
	}
	public AniView(Context context, AttributeSet attrs, int style) {
		super(context, attrs, style);
			setBtnAni();
	}
	@Override
	public void setVisibility(int visibility) {
		Log.e("", "visible ==>>>"+visibility);
		if(visibility==View.VISIBLE)
			clearAnimation();
		else
			startAnimation(refreshani);
		//super.setVisibility(visibility);
	}

	public void setBtnAni() {
		refreshani = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
		refreshani.setInterpolator(new LinearInterpolator());
		refreshani.setDuration(1000);
		refreshani.setRepeatCount(Animation.INFINITE);
	} 
}
